package com.views;

import java.util.ArrayList;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Align;
import android.graphics.drawable.Drawable;
import android.view.View;

import com.src.LifetimeTracker;
import com.src.R;

public class AboutView extends View {
	
	private double widthMultiplier, heightMultiplier;
	
	public AboutView(Context context) {
		super(context);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void onDraw(Canvas canvas){
		super.onDraw(canvas);
		
		setBackgroundDrawable(LifetimeTracker.background);
		
		Paint paint = new Paint();		
		
		paint.setColor(Color.BLACK);
		paint.setTextAlign(Align.CENTER);
		paint.setTextSize(50);
		paint.setFakeBoldText(true);
		
		
		int width = getWidth()/2;
		int height = getHeight();
		Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.lifetimetrackericon);
		int picWidth = mBitmap.getWidth();
		int picHeight = mBitmap.getHeight();
		canvas.drawBitmap(mBitmap, width - (picWidth / 2), (int)(height * 0.1), paint);
		canvas.drawText("Lifetime Tracker", width, (int)((height * 0.4) + picHeight / 4), paint);
		
		ArrayList<String> abouts = new ArrayList<String>();
		abouts.add("Version: " + LifetimeTracker.versionNr);
		abouts.add(LifetimeTracker.versionDate);
		abouts.add("");
		abouts.add("Created by:");
		abouts.add("Bart Toersche");
		abouts.add("Dennis Wonnink");
		abouts.add("");
		abouts.add("(c) 2011 B&D Productions");
		abouts.add("www.lifetimetracker.com");
		
		paint.setFakeBoldText(false);
		paint.setTextSize(30);
		
		int height2 = (int)((height * 0.5) + picHeight / 4);
		for(String s : abouts) {
			canvas.drawText(s, width, height2, paint);
			height2+= 30;
		}
		
	}
}
